/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package practikasdelsalonn;

import java.util.Scanner;


public class ejersicio5 {


    public static void main(String[] args) {
        Scanner a=new Scanner(System.in);
        System.out.println("inicio");
        String cad=a.next();
        String [] prueba=cad.split(",");
        for(int y=0;y<prueba.length;y=2){
            int num=Integer.parseInt(prueba[y]);
            for(int x=0;x<num;x++){
                System.out.println(prueba[y+1]);


            }

        }
    }

}
